package com.zhoufy.service;

import com.alibaba.fastjson.JSON;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-04-18.
 *
 * @author chouFy
 */
public class JSONSerializer implements Serializer {


    @Override
    public byte[] serialize(Object object) {
        return JSON.toJSONBytes(object);

    }


    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) {
        return JSON.parseObject(bytes, clazz);
    }
}
